package JAVATest;

/**
 * ClassName:Text_024
 * Package:JAVATest
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/14-0:30
 * @Version:v1.0
 */
public class Text_024 {
    public static void main(String[] args) {
        int[][] yearArr = {
                {22, 66, 44},
                {77, 33, 88},
                {25, 45, 65},
                {11, 66, 99}
        };
        int yearSum = 0;
        for (int i = 0; i < yearArr.length; i++) {
            int[] quarterArr = yearArr[i];
            int sum = getSum(quarterArr);
            System.out.println("第" + (i + 1) + "个季度的总营业额为:" + sum + "万元");
            yearSum = yearSum + sum;
        }
        System.out.println("全年的总营业额为:" + yearSum + "万元");
    }

    //记录每个季度的总营业额
    public static int getSum(int[] arr) {
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        return sum;
    }
}
